package com.dims_hsrc.common.utils;

import static com.dims_hsrc.common.utils.UEncryptUtil.MD5Encrypt;

/**
 * 密码加密工具
 *
 * @author yinqg
 */
public class UPasswordUtil {
    public static void main(String[] args) {
        System.out.println(MD5Encrypt("123"));
    }


    private static final String PASSWORD_KEY = "passW0rd@Uestc0m.com";

    /**
     * 对密码和随机数一起进行加密
     *
     * @param srcPassword
     * @param salt
     * @return
     */
    public static String encryptUserPassword(String srcPassword, String salt) {
        return encryptUserPassword(srcPassword + "-" + salt);
    }


    /**
     * 对密码进行加密，固定密钥
     *
     * @param srcPassword
     * @return
     */
    public static String encryptUserPassword(String srcPassword) {
        return MD5Encrypt(srcPassword + "-" + PASSWORD_KEY);
    }


}
